package com.ruoyi.linxi;

import com.ruoyi.linxi.business.StandingBookUtil;
import com.ruoyi.linxi.entry.Account;
import com.ruoyi.linxi.business.AccountUtil;
import com.ruoyi.linxi.entry.Invoice;
import com.ruoyi.linxi.entry.StandingBook;
import com.ruoyi.utils.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.List;

/**
 * @Title TODO
 * @Description TODO
 * @Author CAI ZHAI
 * @Date 2021/9/17 22:10
 **/
@Slf4j
public class VerifyAccountingRecord{
    public static void main(String[] args){
        //盘数
        exportAccount();
        
        //台账
        //exportStandingBook();
    }
    
    //盘数
    private static void exportAccount(){
        String oldExcel = "D:\\linxi\\盘数.xlsx";
        //发票
        List<Invoice> invoiceList = ExcelUtil.sheetToObj(oldExcel, 0, Invoice.class);
        AccountUtil.changeInvoiceRoomNumber(invoiceList);
        //银行账单
        List<Account> accountList = ExcelUtil.sheetToObj(oldExcel, 1, Account.class);
        AccountUtil.changeAccountRoomNumber(accountList);
    
        //处理金额
        AccountUtil.addMoney(invoiceList, accountList);
        
        //以发票为准
        AccountUtil.mergeInvoice(invoiceList, accountList);
        //以银行为准
        AccountUtil.mergeAccount(invoiceList, accountList);
        
        //结果
        String newExcel = "D:\\linxi\\result.xlsx";
        AccountUtil.exportInvoiceAccountExcel(oldExcel, newExcel, invoiceList, accountList);
    }
    
    //台账
    private static void exportStandingBook(){
        String oldExcel = "D:\\linxi\\台账.xlsx";
        List<StandingBook> standingBookList = StandingBookUtil.sheetToObj(oldExcel);
        StandingBookUtil.exportStandingBook(standingBookList);
    }
    
    
}
